package com.piesat.quake.business.device.mqtt.pipeline;

import com.piesat.quake.business.device.mqtt.LengthData;
import com.piesat.quake.business.device.mqtt.pipeline.datahandler.DataHandler;

/**
 * 数据解析流水线
 *
 * @author Gersy
 * @date 2023/3/2
 * @since 1.0
 */
public interface DataPipeline {

    DataHandler getLast();

    DataPipeline addFirst(DataHandler handler);

    DataPipeline addLast(DataHandler handler);

    DataPipeline addLast(Class<?> clazz);

    DataPipeline addNode(Class<?> clazz, String nodeFieldName);

    DataPipeline addNode(Class<?> clazz, String nodeFieldName, String[] strings);

    DataPipeline addNode(Class<?> clazz, String parentNode, String nodeFieldName, String[] excludeFields);

    DataPipeline addNode(Class<?> clazz, String parentNode, String nodeFieldName);

    DataPipeline addNode(Class<?> clazz, String parentNode, String nodeFieldName, int size);

    DataPipeline addNode(DataHandler handler, String nodeFieldName);

    DataPipeline addNode(DataHandler handler, String parentNode, String nodeFieldName);

    DataPipeline addNode(DataHandler handler, String parentNode, String nodeFieldName, int size);

    LengthData decode(byte[] bytes);

    byte[] encode(LengthData data);

    int getLength();
}
